home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / COMPILER / SATHER / !Sather / Library / Graphs / sa / wtd_digr < prev   
Text File  |  1996-07-13  |  2KB  |  38 lines

  1. ---------------------------> Sather 1.1 source file <--------------------------
  2. -- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>
  3. -- Copyright (C) 1995, International Computer Science Institute
  4. -- $Id: wtd_digraph.sa,v 1.1 1996/07/13 06:46:51 gomes Exp $
  5. --
  6. -- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY
  7. -- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
  8. -- LICENSE contained in the file: Sather/Doc/License of the
  9. -- Sather distribution. The license is also available from ICSI,
  10. -- 1947 Center St., Suite 600, Berkeley CA 94704, USA.
  11. -------------------------------------------------------------------
  12. class WTD_DIGRAPH{NTP<$STR,WTP<$NUMBER{WTP}} < $LBLD_DIGRAPH{NTP,WTP,WTP} is
  13.    -- A standard directed graph with node and edge weights of type WTP.
  14.    -- The nodes of the graph are of type NTP.
  15.  
  16.    include LBLD_DIGRAPH{NTP,WTP,WTP};
  17.    
  18.    bellman_ford(s:NTP, out d:MAP{NTP,WTP}, out pred:MAP{NTP,NTP}):BOOL is
  19.       -- Call into the digraph algorithm class
  20.       return WTD_DIGRAPH_ALG{NTP,WTP,SAME}::bellman_ford(self,s,out d,out pred);
  21.    end;
  22.    
  23.    dijkstra(src:NTP,out dist:MAP{NTP,WTP},out pred:MAP{NTP,NTP}) is
  24.       -- Call into the digraph algorithm class
  25.       WTD_DIGRAPH_ALG{NTP,WTP,SAME}::dijkstra(self,src,out dist, out pred);
  26.    end;
  27.    
  28.    max_weight_path_node!(once src,once sink: NTP): NTP is
  29.       -- Please see the comment at WTD_DIGRAPH_ALG{_,_,_,_}::max_weight_path
  30.       loop 
  31.      yield WTD_DIGRAPH_ALG{NTP,WTP,SAME}::max_weight_path_node!(self,src,sink); 
  32.       end;
  33.    end;
  34.  
  35.  
  36. end;
  37. -------------------------------------------------------------------
  38.